﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Views="clr-namespace:TauxGaranti.Views"                
    xmlns:ViewModels="clr-namespace:TauxGaranti.ViewModels"
    xmlns:TxGar="clr-namespace:TauxGaranti">
    
    <TxGar:CommandToIconConverter x:Key="CommandToIconConverter" />
    <TxGar:GlossyStyleConverter x:Key="GlossyStyleConverter" />

    <Style TargetType="{x:Type TabItem}" x:Key="tbControlItem" BasedOn="{StaticResource controlOMANE}">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontWeight" Value="Regular"/>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <SolidColorBrush Color="{StaticResource CoulTabControlItemBorder}" />
            </Setter.Value>
        </Setter> 
        <Setter Property="Background" Value="{StaticResource DegradeBckTabItem}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid>
                        <Border
                            Name="Border"
                            Margin="-2,0,-2,0"
                            Background="{TemplateBinding Background}"
                            BorderThickness="1,1,1,0"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            CornerRadius="20,2,0,0">
                            <StackPanel Orientation="Horizontal">
                                <Image></Image>
                                <ContentPresenter x:Name="ContentSite"
                                              VerticalAlignment="Center"
                                              HorizontalAlignment="Center"
                                              ContentSource="Header"
                                              Margin="10,2,8,2"
                                              RecognizesAccessKey="true">
                                </ContentPresenter>
                            </StackPanel>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Panel.ZIndex" Value="99" />
                            <Setter Property="Foreground" Value="{StaticResource BrushDefautMouseOverForeground}" />
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource DegradeDefautMouseOver}" />
                            <Setter TargetName="Border" Property="Margin" Value="-2,-2,-2,0" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource BrushDefautMouseOverBorder}" />
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100" />
                            <Setter Property="Foreground" Value="{StaticResource BrushDefautSelectedForeground}" />
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource DegradeDefaultSelected}" />
                            <Setter TargetName="Border" Property="Margin" Value="-2,-2,-2,0" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource BrushDefautSelectedBorder}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
        
    <!--<DataTemplate x:Key="ClosableTabItemTemplate">
        <Border Name="Border"
                Margin="-2,0,-2,0"
                Background="{StaticResource DegradeBckRdBtn}"
                BorderBrush="{StaticResource BrushCouleur1Base}"
                BorderThickness="1,1,1,0"
                CornerRadius="20,2,0,0">
            <StackPanel Orientation="Horizontal">
                <Image Source="{Binding Converter=CommandToIconConverter}" ></Image>
                <ContentPresenter Content="{Binding Path=DisplayName}" VerticalAlignment="Center"/>
            </StackPanel>
        </Border>
    </DataTemplate>
        <Button 
        Content="X"
        Cursor="Hand"
        Command="{Binding Path=CloseCommand}"
        DockPanel.Dock="Right"
        Focusable="False"
        FontFamily="Courier" 
        FontSize="9"
        FontWeight="Bold"  
        Margin="0,1,0,0"
        Padding="0"
        VerticalContentAlignment="Bottom"
        Width="16" Height="16" 
        />-->



    <Style  x:Key="tbControlOMANE" TargetType="{x:Type TabControl}" BasedOn="{StaticResource controlOMANE}">
        <Style.Resources>
            <DataTemplate DataType="{x:Type ViewModels:ViewModelCmdEncoursImport}">
                <Views:ViewEncoursImport />
            </DataTemplate>
            <DataTemplate DataType="{x:Type ViewModels:ViewModelCmdEncoursCorresp}">
                <Views:ViewEncoursCorresp />
            </DataTemplate>
            <DataTemplate DataType="{x:Type ViewModels:ViewModelCmdEncoursRetrait}">
                <Views:ViewEncoursRetrait />
            </DataTemplate>
        </Style.Resources>
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid KeyboardNavigation.TabNavigation="Local">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TabPanel Name="HeaderPanel" Grid.Row="0" Panel.ZIndex="1" Margin="2,0,0,-1" IsItemsHost="True" 
                                  KeyboardNavigation.TabIndex="1" Background="Transparent" />
                        <Border Name="Border" Grid.Row="1" Background="White" BorderBrush="{StaticResource BrushCouleur1Base}" 
                                BorderThickness="1" CornerRadius="0" KeyboardNavigation.TabNavigation="Local"
                                KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2" >
                            <ContentPresenter Name="PART_SelectedContentHost" Margin="0" ContentSource="SelectedContent" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="Gray" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="Transparent" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


</ResourceDictionary>
